package com.gdglc.spring.biz.impl.auth;

import java.util.List;

import com.gdglc.spring.biz.auth.PageBiz;
import com.github.pagehelper.PageHelper;
import com.y2.authprj.bean.auth.model.FunctionauthorityInfo;
import com.y2.authprj.bean.auth.model.PagedResult;
import com.y2.authprj.bean.auth.model.RoleauthorityInfo;
import com.y2.authprj.bean.auth.model.SysroleInfo;
import com.y2.authprj.bean.auth.vo.PageAuthority;
import com.y2.authprj.bean.auth.vo.PageSysrole;
import com.y2.authprj.bean.auth.vo.ShowRoleByMulitTableVo;
import com.y2.authprj.dao.auth.IFunctionauthorityDao;
import com.y2.authprj.dao.auth.IRoleAuthorityDao;
import com.y2.authprj.dao.auth.ISysroleDao;
import com.y2.authprj.utils.BeanUtil;



public class PageBizImpl implements PageBiz {

	private IRoleAuthorityDao dao;
	private ISysroleDao sysroleDao;
	private IFunctionauthorityDao funDao;
	
	
	public IFunctionauthorityDao getFunDao() {
		return funDao;
	}



	public void setFunDao(IFunctionauthorityDao funDao) {
		this.funDao = funDao;
	}



	public ISysroleDao getSysroleDao() {
		return sysroleDao;
	}



	public void setSysroleDao(ISysroleDao sysroleDao) {
		this.sysroleDao = sysroleDao;
	}



	public IRoleAuthorityDao getDao() {
		return dao;
	}



	public void setDao(IRoleAuthorityDao dao) {
		this.dao = dao;
	}



	@Override
	public PagedResult<ShowRoleByMulitTableVo> queryAuthorityByPage(PageAuthority page, Integer pageNo, Integer pageSize) {
		pageNo = pageNo == null?1:pageNo;
		pageSize = pageSize == null?10:pageSize;
		PageHelper.startPage(pageNo,pageSize);  //startPage是告诉拦截器说我要开始分页了。分页参数是这两个。
		return BeanUtil.toPagedResult(dao.findRoleAuthorityByChooise(page));
	}



	@Override
	public PagedResult<SysroleInfo> querySysroleByPage(PageSysrole page, Integer pageNo, Integer pageSize) {
		pageNo = pageNo == null?1:pageNo;
		pageSize = pageSize == null?10:pageSize;
		PageHelper.startPage(pageNo,pageSize);  //startPage是告诉拦截器说我要开始分页了。分页参数是这两个。
		return BeanUtil.toPagedResult(sysroleDao.findSysroleByChoose(page));
	}



	@Override
	public PagedResult<FunctionauthorityInfo> queryFunctionauthorityByPage(String name, Integer pageNo,
			Integer pageSize) {
		pageNo = pageNo == null?1:pageNo;
		pageSize = pageSize == null?10:pageSize;
		PageHelper.startPage(pageNo,pageSize); 
		return BeanUtil.toPagedResult(funDao.findByName(name));
	}



	@Override
	public PagedResult<SysroleInfo> queryFunctionauthorityByNameByPage(String name, Integer pageNo, Integer pageSize) {
		pageNo = pageNo == null?1:pageNo;
		pageSize = pageSize == null?10:pageSize;
		PageHelper.startPage(pageNo,pageSize); 
		return BeanUtil.toPagedResult(sysroleDao.findByName(name));
	}




		




}


